home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 18476 < prev    next >
Encoding:
Text File  |  1996-08-05  |  2.1 KB  |  70 lines

  1. Path: ix.netcom.com!als-il4-45
  2. From: stefmit@ix.netcom.com
  3. Newsgroups: comp.lang.c++
  4. Subject: Help - what's wrong with this?
  5. Date: 20 Apr 1996 19:56:29 GMT
  6. Organization: Netcom
  7. Message-ID: <4lbfhd$4qo@dfw-ixnews5.ix.netcom.com>
  8. NNTP-Posting-Host: als-il4-45.ix.netcom.com
  9. X-NETCOM-Date: Sat Apr 20  2:56:29 PM CDT 1996
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. Here it is (just snippets of a much larger thing, that I am trying to slice in 
  13. pieces, so that I find out what's wrong one step at a time):
  14.  
  15. // This appears in the "step1.h" file
  16.  
  17. class file_io
  18. {       public:
  19.  
  20.                 // Member functions to process the file
  21.                 void process_in (ifstream &FileName); // Reads in the data 
  22.                             //from file
  23.                                                       // this is line 218
  24.                 void process_out(ofstream &FileName);   // Saves the data in 
  25.                             //the required format
  26.                                                         // this is line 223   
  27.                                                    
  28. };
  29.  
  30.  
  31. // This appears in the "definit1.cpp" where_I_define_things file
  32. // Obviously includes the above "test1.h"
  33.  
  34. void file_io :: process_in (ifstream &FileName)
  35. {       char my_letter;
  36.         int my_int;
  37.         char my_name[45];
  38.         while (FileName >> my_letter >> my_int >> my_name)
  39.                 cout << my_letter << " " << my_int << " " << my_name << endl;
  40. }
  41.  
  42.  
  43. // This is the main function - the program is much larger, but I was
  44. // trying to figure out errors one at a time, by calling each function
  45. // separately
  46.  
  47. void main ()
  48. {       file_io currfile;
  49.         ifstream InFile ("test1.dat");
  50.         if (!InFile)
  51.                 cout << "Error opening file" << "test1.dat" << endl;
  52.         else    {       while (InFile)
  53.                                         {       clrscr();
  54.                                                 currfile.process_in(InFile);}
  55.                         }
  56. }
  57.  
  58. The error I am getting:
  59.  
  60. Compiling DEFINIT1.CPP:
  61. Error STEP1.H 218: ) expected
  62. Error STEP1.H 223: ) expected
  63. Error DEFINIT1.CPP 8: 'file_io::process_in(ifstream &)' is not a member of 
  64. 'file_io'
  65.  
  66. Could anybody help, please? TIA.
  67.  
  68.  
  69.  
  70.